feat: add dynamic parameter type extensions#4290
feat: add dynamic parameter type extensions#4290calebdw wants to merge 4 commits intophpstan:2.1.xfrom
Conversation
49c7da8 to
58e51fb
Compare
58e51fb to
79de0a6
Compare
|
This pull request has been marked as ready for review. |
|
I tested it by porting my previous implementation for Larastan to this one, and looks like it works fine! Will try to implement more use cases and see if I can find any bugs. Also will try to test it on real projects.But so far so good. Thanks for this! I'll also try to review this PR (though Ondrej would do a better job 😄 ) |
79de0a6 to
7c605c1
Compare
ondrejmirtes
left a comment
There was a problem hiding this comment.
This looks solid, just a few questions as a start, will do deep review later 👍
|
@calebdw @ondrejmirtes Sorry to bother you, but I wanted to ask how we can move this forward? I'm really interested in this feature. |
|
No worries, just been busy with personal life, I'll try to get to the comments soon |
b9ce6ac to
b293d32
Compare
|
@ondrejmirtes, @canvural, sorry it took so long to address these comments---just been busy with personal life but hoping to move this forward now 🙏 |
b293d32 to
16430bf
Compare
|
@calebdw - is this still planned on going ahead? Does this fix the issue with using whereHas with custom builders? I've seen multiple projects now look to using custom builders since the implementation of the attribute & official support from Laravel last year, only to find issues when trying to type the arguments in eloquent method for type hints / auto complete, etc. https://laravel-news.com/defining-a-dedicated-query-builder-in-laravel-12-with-php-attributes In the meantime, we have been using whereRelation, which compiles to whereHas under the hood, but it would be nice to use whereHas directly.
|
|
My team are also eagerly awaiting the outcome of this PR! Hope it can be pushed forward 🙏 |
08bc956 to
7823716
Compare
|
@CamKemBell, yes I just rebased and resolved all the conflicts @ondrejmirtes, this is ready to review 👍 |
7823716 to
9e68ce4
Compare
|
What is the status on this PR? |
|
Hi @calebdw sorry for the delay there is now more review for the PHPStan codebase. Are you still interested by the PR ? Thanks ! |
9e68ce4 to
c67e140
Compare
|
@VincentLanglet, yes, the conflicts have been resolved! |
40add44 to
7d80107
Compare
1a52f81 to
5dd28d7
Compare
|
Not sure if all the failure are related to the pr ; but there is more failure than on other PR. |
a699133 to
c89c885
Compare
c89c885 to
781f1dc
Compare
781f1dc to
f59eab2
Compare
|

Closes phpstan/phpstan#11707, closes phpstan/phpstan#12585
Supersedes #3828, supersedes #3131, supersedes #3823
Hello!
This adds generalized dynamic parameter type extensions and deprecates the parameter closure type extensions per phpstan/phpstan#11707 (comment).
This also fixes the
return.typeand theargument.typeerrors described in phpstan/phpstan#12585 when the parameter type is overridden via the extension.Note
The original type from the closure type extensions was being passed around as
$passedToTypeto the methods that needed it. However, I opted to rename this tooverriddenTypesince I wasn't quite sure what$passedToTypereally meant. Let me know if there's something you'd rather do differently.CC: @canvural, @Neol3108
Thanks!